//
//  SAPTwoAudioTableViewCell.m
//  CarsHome
//
//  Created by dapeng on 15/12/17.
//  Copyright © 2015年 dapeng. All rights reserved.
//

#import "SAPTwoAudioTableViewCell.h"

@implementation SAPTwoAudioTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.name = [[UILabel alloc] init];
        self.descrition = [[UILabel alloc] init];
        self.imgurl = [[UIImageView alloc] init];
        self.bigImgurl = [[UIImageView alloc] init];
        [_name release];
        [_descrition release];
        [_imgurl release];
        [_bigImgurl release];
        [self addSubview:self.bigImgurl];
        [self addSubview:self.name];
        [self addSubview:self.descrition];
        [self addSubview:self.imgurl];
        
        [_name release];
        [_descrition release];
        [_imgurl release];
        [_bigImgurl release];
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_SIZE.width, SCREEN_SIZE.height / 4)];
        view.backgroundColor = [UIColor blackColor];
        view.alpha = 0.8;
        [self.bigImgurl addSubview:view];
    }return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.imgurl.frame = CGRectMake(20, (SCREEN_SIZE.height / 4 - SCREEN_SIZE.width / 3 + 40) / 2, SCREEN_SIZE.width / 3 - 40, SCREEN_SIZE.width / 3 - 40);
    self.name.frame = CGRectMake(SCREEN_SIZE.width / 3, (SCREEN_SIZE.height / 4 - SCREEN_SIZE.width / 3 + 40) / 2, SCREEN_SIZE.width - SCREEN_SIZE.width / 3 + 20, 20);
    self.descrition.frame = CGRectMake(SCREEN_SIZE.width / 3, (SCREEN_SIZE.height / 4 - SCREEN_SIZE.width / 3 + 40) / 2 + 20, SCREEN_SIZE.width - SCREEN_SIZE.width / 3 - 20, 60);
    self.bigImgurl.frame = CGRectMake(0, 0, SCREEN_SIZE.width, SCREEN_SIZE.height / 4);
}
- (void)setAlbum_descrition:(NSString *)album_descrition {
    if (_album_descrition != album_descrition) {
        [_album_descrition release];
        _album_descrition = [album_descrition retain];
    }
    self.descrition.text = album_descrition;
    self.descrition.font = [UIFont systemFontOfSize:13];
    self.descrition.numberOfLines = 3;
    self.descrition.textColor = [UIColor lightGrayColor];
}
- (void)setAlbum_imgurl:(NSString *)album_imgurl {
    if (_album_imgurl != album_imgurl) {
        [_album_imgurl release];
        _album_imgurl = [album_imgurl retain];
    }
    [self.imgurl sd_setImageWithURL:[NSURL URLWithString:album_imgurl]];
    self.imgurl.layer.cornerRadius = (SCREEN_SIZE.width / 3 - 40) / 2;
    self.imgurl.layer.masksToBounds = YES;
    NSString *str = [album_imgurl stringByReplacingOccurrencesOfString:@"200x0_0_" withString:@""];
    [self.bigImgurl sd_setImageWithURL:[NSURL URLWithString:str]];
    
    
}
- (void)setBigImgurl:(UIImageView *)bigImgurl {
    if (_bigImgurl != bigImgurl) {
        [_bigImgurl release];
        _bigImgurl = [bigImgurl retain];
    }
}
- (void)setAlbum_name:(NSString *)album_name {
    if (_album_name != album_name) {
        [_album_name release];
        _album_name = [album_name retain];
    }
    self.name.text = album_name;
    self.name.textColor = [UIColor whiteColor];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
